/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.desitek.cricket.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Dhiraj
 */
@Entity
@Table(name = "user_groups")
@NamedQueries({@NamedQuery(name = "Groups.findByGrpId", query = "SELECT g FROM Groups g WHERE g.grpId = :grpId"), @NamedQuery(name = "Groups.findByGrpDescription", query = "SELECT g FROM Groups g WHERE g.grpDescription = :grpDescription"), @NamedQuery(name = "Groups.findByGrpName", query = "SELECT g FROM Groups g WHERE g.grpName = :grpName"), @NamedQuery(name = "Groups.findByGrpStatus", query = "SELECT g FROM Groups g WHERE g.grpStatus = :grpStatus")})
public class Groups implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name = "grp_id", nullable = false)
    private Integer grpId;
    @Column(name = "grp_description")
    private String grpDescription;
    @Column(name = "grp_name", nullable = false)
    private String grpName;
    @Column(name = "grp_status")
    private Boolean grpStatus;
    @OneToMany(mappedBy = "userGroup")
    private Collection<User> userCollection;

    public Groups() {
    }

    public Groups(Integer grpId) {
        this.grpId = grpId;
    }

    public Groups(Integer grpId, String grpName) {
        this.grpId = grpId;
        this.grpName = grpName;
    }

    public Integer getGrpId() {
        return grpId;
    }

    public void setGrpId(Integer grpId) {
        this.grpId = grpId;
    }

    public String getGrpDescription() {
        return grpDescription;
    }

    public void setGrpDescription(String grpDescription) {
        this.grpDescription = grpDescription;
    }

    public String getGrpName() {
        return grpName;
    }

    public void setGrpName(String grpName) {
        this.grpName = grpName;
    }

    public Boolean getGrpStatus() {
        return grpStatus;
    }

    public void setGrpStatus(Boolean grpStatus) {
        this.grpStatus = grpStatus;
    }

    public Collection<User> getUserCollection() {
        return userCollection;
    }

    public void setUserCollection(Collection<User> userCollection) {
        this.userCollection = userCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (grpId != null ? grpId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Groups)) {
            return false;
        }
        Groups other = (Groups) object;
        if ((this.grpId == null && other.grpId != null) || (this.grpId != null && !this.grpId.equals(other.grpId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.desitek.cricket.entity.Groups[grpId=" + grpId + "]";
    }

}
